home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10218 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  46 lines

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: ** Disabling ctrl-C in C **
  5. Date: Sat, 16 Mar 96 00:18:20 GMT
  6. Organization: none
  7. Message-ID: <826935500snz@genesis.demon.co.uk>
  8. References: <4hpbv3$6u@maltese.eag.unisysgsg.com> <31435190.45C2@post.drexel.edu>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: disperse.demon.co.uk!post.demon.co.uk!genesis.demon.co.uk
  13.  
  14. In article <31435190.45C2@post.drexel.edu>
  15.            st94e485@post.drexel.edu "Sean P Kelly" writes:
  16.  
  17. ...
  18.  
  19. >#include <termio.h>
  20. >
  21. >  struct termio term_init;
  22. >  struct termio termnew;
  23. >
  24. >ioctl(0, TCGETA, &term_init);   /*stores initial terminal conditions*/
  25. >
  26. >termnew = term_init;
  27. >termnew.c_lflag &= ~ISIG;
  28. >
  29. >ioctl (0,TCSETAF, &termnew);   /*terminal now ignores signals*/
  30. >
  31. >if (ioctl (0,TCSETAF,&term_init);  /*sets terminal back to initial conditions*/
  32.  
  33. That seems an excessively long-winded and non-portable way of writing:
  34.  
  35. #include <signal.h>
  36.  
  37.     signal(SIGINT, SIG_IGN);
  38.  
  39. :-)
  40.  
  41. -- 
  42. -----------------------------------------
  43. Lawrence Kirby | fred@genesis.demon.co.uk
  44. Wilts, England | 70734.126@compuserve.com
  45. -----------------------------------------
  46.